Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to elpi 2.0 #708

Closed
wants to merge 14 commits into from
Closed

Port to elpi 2.0 #708

wants to merge 14 commits into from

Conversation

gares
Copy link
Contributor

@gares gares commented Oct 25, 2024

The main visible change in Elpi 2.0 is that the compiler performs type checking incrementally (as units gets added to the base program) and reports error messages with a precise location. The new type checker is written in OCaml and is much faster, but a bit less permissive. Before this PR all type declarations were merged together before type checking the entire program. With Elpi 2.0 compilation units need to type check using the types declared inside them (or in the base they extend).

Elpi Typecheck becomes useless.

A subtle difference is that rules belonging to a Db are type checked against the Db only, not the programs that uses them or the program that generates them.
This means Db rules "work" in the context of any Db user. But rules cannot call any of the code of these programs (the type checker complains about undefined symbols). Unless the types of the predicates they call are also declared in the Db (not necessarily their code: ensuring that the code is finally available is left to the programmer for now). Elpi Accumulate dbname File name. can mitigate this issue by putting in name the code (or at least the type declarations) needed by the rules in the Db.

This PR also adds Elpi File name code. to declare a (virtual) file that can be easily accumulated to Dbs or Programs.

This PR also adds a scope attribute to Elpi Accumulate, in particular #[superglobal] Elpi Accumulate dbname File stuff ensure the Db always contains stuff (a bit like it did always contain its header).

This PR adds a new command Elpi Accumulate Db Header to accumulate the header (type declaration typically) of a Db but not its code. The idiom is to accumulate the Db header early and the Db contents late. This can speed up the (re)compilation of large programs when the db is extended.

TODO:

  • Elpi Accumulate File Signature foo.

@gares gares changed the title wip Port to elpi 2.0 Nov 13, 2024
@gares gares force-pushed the elpi-new-compiler branch 3 times, most recently from c8ed413 to d83271f Compare November 15, 2024 09:20
@gares
Copy link
Contributor Author

gares commented Nov 27, 2024

closed in favor of #719

@gares gares closed this Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant